package com.java1234.dao;

import com.java1234.model.Semester;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.util.List;

public class SemesterDao {


    public int addSemester(Connection con, Semester semester) throws Exception{
        String sql = "insert into t_semester values(null,?,?,?,?,?)";
        PreparedStatement preparedStatement = con.prepareStatement(sql);
        preparedStatement.setDate(1, (Date) semester.getCourseStartDate());
        preparedStatement.setDate(2, (Date) semester.getEndDate());
        preparedStatement.setInt(3,semester.getCount());
        preparedStatement.setDate(4, (Date) semester.getStartDate());
        preparedStatement.setDate(5, (Date) semester.getEndDate());
        return preparedStatement.executeUpdate();
    }




}
